import "./assets/css/reset.css";
// import "./assets/css/index.css";
// import "./assets/less/main.less";
import "./assets/scss/main.scss";
import img1 from "./assets/images/优雅.jpg";
import img2 from "./assets/images/智能.jpg";
import img3 from "./assets/images/迅捷.jpg";
import svgTravel from "./assets/icon/年度旅游.svg";
import "./assets/css/iconfont.css";

document.addEventListener("DOMContentLoaded", () => {
    const currentTheme = localStorage.getItem("theme") || "light";
    document.documentElement.classList.add(currentTheme);

    const switchThemeBtn = document.getElementById("switchThemeBtn");
    switchThemeBtn.addEventListener("click", toggleTheme);

    // 处理图片
    const img1Element = document.querySelector(".img1");
    const img2Element = document.querySelector(".img2");
    const img3Element = document.querySelector(".img3");
    img1Element.src = img1;
    img2Element.src = img2;
    img3Element.src = img3;


    const svgTravelEle = document.querySelector(".svg-travel");
    svgTravelEle.src = svgTravel;

})

function toggleTheme(){
    const root = document.documentElement;
    const currentTheme = root.classList.contains("dark") ? "light" : "dark";
    root.classList = currentTheme;
    // root.classList.toggle("dark", currentTheme === "dark");
    localStorage.setItem("theme", currentTheme);
}